From 303cb22e7b276ffe306ce323719889e6843fa4a7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 28 Dec 2020 12:13:35 +0000 Subject: [PATCH] Fix type of gtk-cursor-aspect-ratio so it can be set in settings.ini --- debian/patches/series | 1 + ...ursor-aspect-ratio-from-float-to-dou.patch | 100 ++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 debian/patches/series create mode 100644 debian/patches/settings-Change-gtk-cursor-aspect-ratio-from-float-to-dou.patch diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..699d8c2088 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +settings-Change-gtk-cursor-aspect-ratio-from-float-to-dou.patch diff --git a/debian/patches/settings-Change-gtk-cursor-aspect-ratio-from-float-to-dou.patch b/debian/patches/settings-Change-gtk-cursor-aspect-ratio-from-float-to-dou.patch new file mode 100644 index 0000000000..fc84cbe601 --- /dev/null +++ b/debian/patches/settings-Change-gtk-cursor-aspect-ratio-from-float-to-dou.patch @@ -0,0 +1,100 @@ +From: Sebastian Keller +Date: Wed, 16 Dec 2020 20:57:31 +0100 +Subject: settings: Change gtk-cursor-aspect-ratio from float to double + +Float properties can not be read from keyfiles. This was causing changes +to this property in settings.ini to be ignored. Fix this by changing it +to a double. + +Technically this change could be considered an API break, but there are +no users of this property as float yet and it is early enough to expect +there to never be any. + +Also document this change in the 3 to 4 migration guide since in gtk 3 +this setting will be kept a float. + +Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/3441 +Origin: upstream, 4.0.1, commit:02f06813447cd3a4dfe3472e942bc94a21e5f6c3 +--- + docs/reference/gtk/migrating-3to4.md | 5 +++++ + gtk/gtksettings.c | 10 +++++----- + gtk/gtkstylecontext.c | 8 ++++---- + 3 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md +index 461be38..a8ba76e 100644 +--- a/docs/reference/gtk/migrating-3to4.md ++++ b/docs/reference/gtk/migrating-3to4.md +@@ -1157,6 +1157,11 @@ shows a #GtkFileChooserNative dialog when clicked; once the file selection + has completed, you can update the label of the #GtkButton with the selected + file. + ++### Adapt to changed GtkSettings properties ++ ++In GTK 3 the #GtkSettings:gtk-cursor-aspect-ratio property of #GtkSettings was ++a float. In GTK 4 this has been changed to a double. ++ + ## Changes to consider after the switch + + GTK 4 has a number of new features that you may want to take +diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c +index 6345550..595e7a1 100644 +--- a/gtk/gtksettings.c ++++ b/gtk/gtksettings.c +@@ -386,11 +386,11 @@ gtk_settings_class_init (GtkSettingsClass *class) + g_assert (result == PROP_SPLIT_CURSOR); + + result = settings_install_property_parser (class, +- g_param_spec_float ("gtk-cursor-aspect-ratio", +- P_("Cursor Aspect Ratio"), +- P_("The aspect ratio of the text caret"), +- 0.0, 1.0, 0.04, +- GTK_PARAM_READWRITE)); ++ g_param_spec_double ("gtk-cursor-aspect-ratio", ++ P_("Cursor Aspect Ratio"), ++ P_("The aspect ratio of the text caret"), ++ 0.0, 1.0, 0.04, ++ GTK_PARAM_READWRITE)); + g_assert (result == PROP_CURSOR_ASPECT_RATIO); + + result = settings_install_property_parser (class, +diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c +index 598c255..71f4750 100644 +--- a/gtk/gtkstylecontext.c ++++ b/gtk/gtkstylecontext.c +@@ -969,7 +969,7 @@ draw_insertion_cursor (GtkStyleContext *context, + double x, + double y, + double height, +- float aspect_ratio, ++ double aspect_ratio, + gboolean is_primary, + PangoDirection direction, + gboolean draw_arrow) +@@ -1032,7 +1032,7 @@ draw_insertion_cursor (GtkStyleContext *context, + + static void + get_insertion_cursor_bounds (double height, +- float aspect_ratio, ++ double aspect_ratio, + PangoDirection direction, + gboolean draw_arrow, + graphene_rect_t *bounds) +@@ -1073,7 +1073,7 @@ static void + snapshot_insertion_cursor (GtkSnapshot *snapshot, + GtkStyleContext *context, + double height, +- float aspect_ratio, ++ double aspect_ratio, + gboolean is_primary, + PangoDirection direction, + gboolean draw_arrow) +@@ -1136,7 +1136,7 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot, + { + GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context); + gboolean split_cursor; +- float aspect_ratio; ++ double aspect_ratio; + PangoRectangle strong_pos, weak_pos; + PangoRectangle *cursor1, *cursor2; + GdkSeat *seat; -- 2.30.2